import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import 'leaflet/dist/leaflet.css'
import L from 'leaflet'
import VueDirectiveImagePreviewer from 'vue-directive-image-previewer'
import 'vue-directive-image-previewer/dist/assets/style.css'
import CKEditor from '@ckeditor/ckeditor5-vue2'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
// 引入生成二维码插件
import QRCode from "qrcode"


Vue.prototype.$QRCode = QRCode

Vue.use(VueQuillEditor)

Vue.use(CKEditor)



axios.interceptors.request.use((config) => {
  config.headers.token = window.sessionStorage.getItem('token')
  return config
})

axios.interceptors.response.use((config) => {
  if (config.data.code === '401') {
    router.push('/login')
  }
  return config
})


Vue.use(VueDirectiveImagePreviewer)

Vue.prototype.$L = L
Vue.config.productionTip = false
Vue.use(ElementUI)

Vue.prototype.$axios = axios
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
